package com.ynsj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ynsj.mapper.UserAuthInfoMapper;
import com.ynsj.domain.UserAuthInfo;
import com.ynsj.service.UserAuthInfoService;
@Service
public class UserAuthInfoServiceImpl extends ServiceImpl<UserAuthInfoMapper, UserAuthInfo> implements UserAuthInfoService{

    /**
     * 根据用户id查询用户认证列表
     *
     * @param id
     * @return
     */
    @Override
    public List<UserAuthInfo> findByUserId(Long id) {
        List<UserAuthInfo> list = list(new LambdaQueryWrapper<UserAuthInfo>().eq(id != null, UserAuthInfo::getUserId, id));
        return list == null ? Collections.emptyList():list;
    }

    /**
     * 根据用户认证码查询用户认证列表
     *
     * @param authCode@return
     */
    @Override
    public List<UserAuthInfo> findByAuthCode(Long authCode) {
        return list(new LambdaQueryWrapper<UserAuthInfo>()
                .eq(authCode!=null,UserAuthInfo::getAuthCode,authCode));
    }
}
